Integrand size = 21, antiderivative size = 100 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {\left (a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {2 a b \csc (c+d x)}{d}-\frac {2 a b \csc ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d} \]
[Out]
Time = 0.37 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3957, 2990, 2701, 308, 213, 459} \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {\left (a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}+\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \csc ^3(c+d x)}{3 d}-\frac {2 a b \csc (c+d x)}{d}+\frac {b^2 \tan (c+d x)}{d} \]
[In]
[Out]
Rule 213
Rule 308
Rule 459
Rule 2701
Rule 2990
Rule 3957
Rubi steps \begin{align*} \text {integral}& = \int (-b-a \cos (c+d x))^2 \csc ^4(c+d x) \sec ^2(c+d x) \, dx \\ & = (2 a b) \int \csc ^4(c+d x) \sec (c+d x) \, dx+\int \left (b^2+a^2 \cos ^2(c+d x)\right ) \csc ^4(c+d x) \sec ^2(c+d x) \, dx \\ & = \frac {\text {Subst}\left (\int \frac {\left (1+x^2\right ) \left (a^2+b^2+b^2 x^2\right )}{x^4} \, dx,x,\tan (c+d x)\right )}{d}-\frac {(2 a b) \text {Subst}\left (\int \frac {x^4}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = \frac {\text {Subst}\left (\int \left (b^2+\frac {a^2+b^2}{x^4}+\frac {a^2+2 b^2}{x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d}-\frac {(2 a b) \text {Subst}\left (\int \left (1+x^2+\frac {1}{-1+x^2}\right ) \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {\left (a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {2 a b \csc (c+d x)}{d}-\frac {2 a b \csc ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d}-\frac {(2 a b) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = \frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {\left (a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {2 a b \csc (c+d x)}{d}-\frac {2 a b \csc ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d} \\ \end{align*}
Leaf count is larger than twice the leaf count of optimal. \(259\) vs. \(2(100)=200\).
Time = 1.28 (sec) , antiderivative size = 259, normalized size of antiderivative = 2.59 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {\csc ^5\left (\frac {1}{2} (c+d x)\right ) \sec ^3\left (\frac {1}{2} (c+d x)\right ) \left (-3 a^2-14 a b \cos (c+d x)-2 \left (a^2+4 b^2\right ) \cos (2 (c+d x))+6 a b \cos (3 (c+d x))+a^2 \cos (4 (c+d x))+4 b^2 \cos (4 (c+d x))-6 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+6 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+3 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))-3 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))\right )}{96 d \left (-1+\cot ^2\left (\frac {1}{2} (c+d x)\right )\right )} \]
[In]
[Out]
Time = 1.67 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.16
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )}{d}\) | \(116\) |
default | \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )}{d}\) | \(116\) |
parallelrisch | \(\frac {-96 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )+96 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )-\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (\left (a^{2}+4 b^{2}\right ) \cos \left (2 d x +2 c \right )+\left (-\frac {a^{2}}{2}-2 b^{2}\right ) \cos \left (4 d x +4 c \right )+\frac {3 a \left (\frac {14 \cos \left (d x +c \right ) b}{3}-2 b \cos \left (3 d x +3 c \right )+a \right )}{2}\right ) \csc \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{48 d \cos \left (d x +c \right )}\) | \(150\) |
risch | \(-\frac {4 i \left (3 a b \,{\mathrm e}^{7 i \left (d x +c \right )}-7 a b \,{\mathrm e}^{5 i \left (d x +c \right )}-3 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-7 a b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-8 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+3 a b \,{\mathrm e}^{i \left (d x +c \right )}+a^{2}+4 b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) | \(177\) |
norman | \(\frac {\frac {a^{2}+2 a b +b^{2}}{24 d}-\frac {3 \left (a^{2}+5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{4 d}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{24 d}+\frac {\left (2 a^{2}-7 a b +5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{6 d}+\frac {\left (2 a^{2}+7 a b +5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{6 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}-\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(198\) |
[In]
[Out]
none
Time = 0.27 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.78 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {6 \, a b \cos \left (d x + c\right )^{3} + 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 8 \, a b \cos \left (d x + c\right ) - 3 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) + 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) + 3 \, b^{2}}{3 \, {\left (d \cos \left (d x + c\right )^{3} - d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )} \]
[In]
[Out]
\[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \csc ^{4}{\left (c + d x \right )}\, dx \]
[In]
[Out]
none
Time = 0.20 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.12 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {a b {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{2} + 1\right )}}{\sin \left (d x + c\right )^{3}} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + b^{2} {\left (\frac {6 \, \tan \left (d x + c\right )^{2} + 1}{\tan \left (d x + c\right )^{3}} - 3 \, \tan \left (d x + c\right )\right )} + \frac {{\left (3 \, \tan \left (d x + c\right )^{2} + 1\right )} a^{2}}{\tan \left (d x + c\right )^{3}}}{3 \, d} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 226 vs. \(2 (96) = 192\).
Time = 0.34 (sec) , antiderivative size = 226, normalized size of antiderivative = 2.26 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 48 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 48 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + 9 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 30 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 21 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {48 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {9 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 30 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 21 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a^{2} + 2 \, a b + b^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]
[In]
[Out]
Time = 14.68 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.82 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,{\left (a-b\right )}^2}{24\,d}-\frac {\frac {2\,a\,b}{3}-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (3\,a^2+10\,a\,b+23\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {8\,a^2}{3}+\frac {28\,a\,b}{3}+\frac {20\,b^2}{3}\right )+\frac {a^2}{3}+\frac {b^2}{3}}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2}{8}-\frac {3\,a\,b}{4}+\frac {5\,b^2}{8}+\frac {{\left (a-b\right )}^2}{4}\right )}{d}+\frac {4\,a\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]
[In]
[Out]